package com.platform.common.utils;

import cn.hutool.core.util.ObjectUtil;
import com.platform.common.exception.BusinessException;

public class ValidUtils {

    public static void notNull(Object val) {
        notNull("参数不能为空！", val);
    }

    public static void allNotNull(Object... val) {
        allNotNull("参数不能为空！", val);
    }

    private static void notNull(String errorMessage, Object val) {
        if (ObjectUtil.isEmpty(val)) {
            throw new BusinessException(errorMessage);
        }
    }

    private static void allNotNull(String errorMessage, Object... val) {
        if (!ObjectUtil.isAllNotEmpty(val)) {
            throw new BusinessException(errorMessage);
        }
    }

}
